/////////////////////////////////////////////////////////////////////////////
// Copyright(c) 2012-2015 purang All Rights Reserved
// Name:        pr_com_impl.h
// Purpose:
// Author:      syy
// Modified by:
// Created:     2014/3/18 10:16
// RCS-ID:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _PR_COM_H_
#define _PR_COM_H_

#include <atlcomcli.h>

#include "core/comdefs.h"
#include "core/common_types.h"
namespace qb {
typedef HRESULT(__stdcall* DLLGETCLASSOBJECT)(const CLSID& clsid,
                                              const IID& iid, void** ppv);
class SharedData;
class QbCom {
 public:
  QbCom();

  virtual ~QbCom();

  virtual int32_t Load(LPCTSTR lpDLL);

  virtual int32_t Unload();

  virtual int32_t CreateInstance(const CLSID& clsid, const IID& iid,
                                 void** ppv);

  static void GetPath(TCHAR szPath[MAX_PATH]);
  static void GetPath(TCHAR szPath[MAX_PATH], LPCTSTR lpFilename);

 private:
  HMODULE _hDLL;
  DLLGETCLASSOBJECT _lpDllGetClassObject;
};
}  // namespace qb

#endif  // _PR_COM_H_
